package controller;

import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;

import javax.swing.JFrame;

public class FullScreenController implements WindowStateListener {

	private JFrame frame;
		
	public FullScreenController(JFrame frame){
		this.frame = frame;

	}
	@Override
	public void windowStateChanged(WindowEvent e) {
		if(e.getNewState() == JFrame.MAXIMIZED_BOTH){
			frame.dispose();
			frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
			frame.setUndecorated(true);
			frame.setVisible(true);
			frame.requestFocus();
			
		}
		
	}

}
